<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8" />
<title></title>
<meta name="content-type" content="text/html; charset=UTF-8" />
<style>
html {
	margin: 0;
}

body {
	margin: 0;
}

#layout {
	border: 0px solid black;
	text-align: center;
	margin: 60px auto;
}

</style>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
	<div align="center" style="margin-top: 20%">
		<h1>${message}</h1>
	</div>
	<div id="login" style="margin-top:75%;margin-left: 15%;margin-right:15%;">
		<button style="width:100%;height:165px;background-color:#44B549;border-radius:20px;" onclick="login()"><font size="170px" color="white">确认登陆</font></button>
	</div>
	<div id="close"  style="margin-top:75%;margin-left: 15%;margin-right:15%;">
        <button style="width:100%;height:165px;background-color:#44B549;border-radius:20px;" onclick="WeixinJSBridge.call('closeWindow');"><font size="170px" color="white">关闭</font></button>
    </div>
	<div id="unbind"  style="margin-top:75%;margin-left: 15%;margin-right:15%;">
        <button style="width:100%;height:165px;background-color:#44B549;border-radius:20px;" onclick="WeixinJSBridge.call('closeWindow');"><font size="170px" color="white">用户没有绑定</font></button>
    </div>
	<div id="timeout"  style="margin-top:75%;margin-left: 15%;margin-right:15%;">
        <button style="width:100%;height:165px;background-color:#44B549;border-radius:20px;" onclick="WeixinJSBridge.call('closeWindow');"><font size="170px" color="white">二维码超时</font></button>
    </div>
</body>

<script type="text/javascript">
    $("#login").show();
    $("#close").hide();
    $("#unbind").hide();
    $("#timeout").hide();
</script>
<script type="text/javascript">

    function login(){
    	$.ajax({
            type : "post",
            url : "${basePath}dologin",
            data : {
                mic :'${mic}',
                code:'${code}'
            },
            dataType : "json",
            success : function(data) {
            	if(data.flag==1){
                    $("#login").hide();
                    $("#close").show();
            	}else if(data.flag==-1){
            		$("#login").hide();
            		$("#unbind").show();
            	}else if(data.flag==0){
            		$("#login").hide();
                    $("#timeout").show();
            	}
            	
            }
        });
    }
</script>

</html>